import request from '@/config/axios'

// 盘点 VO
export interface CheckvouchVO {
  id: number // id
  code: string // 流水号
  personId: string // 业务员编码
  deptId: string // 部门编码
  warehouseId: string // 仓库编码
  ddate: Date // 订单日期
  cmemo: string // 备注
  createBy: number // 创建人
  updateBy: number // 变更人
}

// 盘点 API
export const CheckvouchApi = {
  // 查询盘点分页
  getCheckvouchPage: async (params: any) => {
    return await request.get({ url: `/wms/checkvouch/page`, params })
  },

  // 查询盘点详情
  getCheckvouch: async (id: number) => {
    return await request.get({ url: `/wms/checkvouch/get?id=` + id })
  },

  // 新增盘点
  createCheckvouch: async (data: CheckvouchVO) => {
    return await request.post({ url: `/wms/checkvouch/create`, data })
  },

  // 修改盘点
  updateCheckvouch: async (data: CheckvouchVO) => {
    return await request.put({ url: `/wms/checkvouch/update`, data })
  },

  // 删除盘点
  deleteCheckvouch: async (id: number) => {
    return await request.delete({ url: `/wms/checkvouch/delete?id=` + id })
  },

  // 导出盘点 Excel
  exportCheckvouch: async (params) => {
    return await request.download({ url: `/wms/checkvouch/export-excel`, params })
  },
      //提交
      submit: async (id: number) => {
        return await request.get({ url: `/wms/checkvouch/startProcess?id=` + id })
      },
// ==================== 子表（盘点子） ====================

  // 获得盘点子列表
  getCheckvouchsListByPid: async (pid) => {
    return await request.get({ url: `/wms/checkvouch/checkvouchs/list-by-pid?pid=` + pid })
  },

    // 获得盘点子详情
    getCheckvouchs: async (id) => {
      return await request.get({ url: `/wms/checkvouch/checkvouchs/getCheckvouchs?id=` + id })
    },
}
